package main

import (
	"fmt"
	"math/rand"
	"time"
)

func task1() {
	for i := 1; i <= 9; i++ {
		for j := i; j <= 9; j++ {
			fmt.Printf("%v * %v = %v\t", i, j, i*j)
			if j == 9 {
				fmt.Printf("\n")
			}
		}
	}

}

func task2() {
	sr := rand.New(rand.NewSource(time.Now().UnixNano()))
	var numlist = make([]int, 0, 20)
	for i := 1; i <= 20; i++ {
		numlist = append(numlist, sr.Intn(99)+1)
	}
	sum := 0
	qua := 1
	for i, v := range numlist {
		if i%2 == 0 {
			sum += v
		} else {
			qua *= v
		}
	}
	fmt.Printf("随机数为：%v\n", numlist)
	fmt.Printf("累加求和为：%v \n累乘求积为：%v\n", sum, qua)

}

func task3() {
	a, b := 0, 1
	for {
		if a >= 100 {
			break
		}
		fmt.Println(a)
		a, b = b, a+b
	}
}

func main() {
	task1()
	task2()
	task3()
}
